#include<iostream> using namespace std; /* it is ok to use this practice of "using directives" but issue arise when we use many libraries, it creates problem related with naming, cuase naming conflict. : it puts everything inside standard namespace and make it available to use directly. so that we don't have to prefix using std:: we can use this directive inside the main () as well. if we use std::cout<< we mean that we want to use cout object in standard namespace alternative is to use declaration : using std::cout; // this is called declaration example: #include<iostream> int main() { using std::cout; // this is to extract only the cout from standard namespaces cout<<"hi there, this is called declaration of cout\n"; } */ int main() { cout<<"this is an example of cout without std::cout<<;\n"; /* /* hi there */ */ } /* Location of this statement/declaration matters: if we use it outside main() then it allowes to use cout without prefixing in whole program, else if we declare it inside main() then it only allowes to use it inside the main() body. Following code will generate error: #include<iostream> int main() { using std::cout; cout<<"hi there"; } void test(){ cout<<"it will fail as cout is delcared only inside main()"; } following code will not generate error: #include<iostream> using std::cout; int main() { cout<<"hi there"; } void test(){ cout<<"it will fail as cout is delcared only inside main()"; } */